import React, { Component } from 'react';
import { BarChart } from '_platform/components4max/Charts/Bar';
const test = ['项目MMMMMM','系统XXXXX']
export default class RPC extends Component {
    render() {
        return (
            <BarChart style={{ width: '100%', height: '100%' }} option={
                {
                    tooltip: {
                        trigger: 'axis',
                        axisPointer: {            // 坐标轴指示器，坐标轴触发有效
                            type: 'shadow'        // 默认为直线，可选为：'line' | 'shadow'
                        }
                    },
                    legend: {
                        data: ['1', '2'],
                        textStyle: {
                            color: '#fff'
                        }
                    },
                    grid: {
                        left: '3%',
                        right: '4%',
                        bottom: '3%',
                        containLabel: true,
                        show: false
                    },
                    xAxis: {
                        type: 'value',
                        axisLine: {
                            lineStyle: {
                                color: 'rgba(0,0,0,0)'
                            }
                        },
                        axisLabel: {
                            color: 'rgba(0,0,0,0)'
                        },
                        splitLine: {
                            lineStyle: {
                                color: 'rgba(0,0,0,0)'
                            }
                        }
                    },
                    yAxis: {
                        type: 'category',
                        data: ['一', '二'],
                        axisLine: {
                            lineStyle: {
                                color: 'rgba(0,0,0,0)'
                            }
                        },
                        axisLabel: {
                            color: 'rgba(0,0,0,0)'
                        },
                        splitLine: {
                            lineStyle: {
                                color: 'rgba(0,0,0,0)'
                            }
                        }
                    },
                    series: [
                        {
                            type: 'bar',
                            itemStyle: {
                                normal: {
                                    color: 'rgba(8,8,8,0)'
                                }
                            },
                            silent: true,
                            barWidth: 20,
                            barGap: '50%', // Make series be overlap
                            data: [400, 400],

                            label: {
                                normal: {
                                    show: true,
                                    position: '',
                                    formatter: (param) => {
                                        console.log('formatter', param);
                                        return test[param.dataIndex]
                                    },
                                    fontSize:'18'
                                }
                            }
                        },
                        {
                            name: '1',
                            type: 'bar',
                            stack: '总量',
                            label: {
                                normal: {
                                    show: true,
                                    position: 'insideLeft'
                                }
                            },
                            barWidth: '20px',
                            data: [320, 302],
                            itemStyle: {
                                barBorderRadius: [10, 0, 0, 10]
                            }
                        },
                        {
                            name: '2',
                            type: 'bar',
                            stack: '总量',
                            label: {
                                normal: {
                                    show: true,
                                    position: 'insideLeft'
                                }
                            },
                            barWidth: '20px',
                            data: [120, 132],
                            itemStyle: {
                                barBorderRadius: [0, 10, 10, 0]
                            }
                        }
                    ]
                }
            } />
        )
    }
}